import { request } from "@/utils/service"

export interface IMemberships {
  id?: number
  timeLimit: number
  limitUnit: number
  originalPrice: number
  price: number
}

export interface ICreateMembershipsDataApi {
  timeLimit: number
  limitUnit: number
  originalPrice: number
  price: number
}

export interface IGetMembershipsListDataApi {
  /** 当前页码 */
  pageNum: number
  /** 查询条数 */
  pageSize: number
}

export function createMemberships(data: ICreateMembershipsDataApi) {
  return request({
    url: "/travel/manage/memberships/create",
    method: "post",
    data
  })
}

export function updateMemberships(id: number, data: ICreateMembershipsDataApi) {
  return request({
    url: "/travel/manage/memberships/update/" + id,
    method: "put",
    data
  })
}

export function getMembershipsList(params: IGetMembershipsListDataApi) {
  return request({
    url: "/travel/manage/memberships/list",
    method: "get",
    params
  })
}

export function deleteMemberships(id: number) {
  return request({
    url: "/travel/manage/memberships/delete/" + id,
    method: "delete"
  })
}
